package com.lf.service.impl;

import com.lf.mapper.ProductMapper;
import com.lf.model.EbProduct;
import com.lf.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<EbProduct> list(int page, int pageSize) {
        return productMapper.findByPage((page - 1) * pageSize, pageSize);
    }

    @Override
    public int getMaxPage(int pageSize) {
        int result= productMapper.getMaxPage(pageSize);
        return result;
    }
    @Override
    public int save(EbProduct ebProduct){
        return productMapper.save(ebProduct);
    }

    @Override
    public EbProduct selectByCondition(Integer epId){
        return productMapper.findById(epId);
    }

    @Override
    public int updateById(EbProduct ebProduct){
        return productMapper.updateByPrimaryKey(ebProduct);
    }
@Override
public  int delete(Integer id){
    return productMapper.delete(id);
}
}